/* Class9 - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */

public abstract class Class9 {
	public int anInt129;
	public Class11 aClass11_130;
	public static JString aClass3_131;
	public boolean aBoolean132;
	public static int anInt133;
	public int[] anIntArray134;
	public static JString aClass3_135 = Class39_Sub5_Sub9.createJString(124, "Loaded sprites");
	public Class11[] aClass11Array136;
	public byte[][] aByteArrayArray137;
	public byte[][][] aByteArrayArrayArray138;
	public int[][] anIntArrayArray139;
	public static JString aClass3_140;
	public static Class39_Sub5_Sub10_Sub3 aClass39_Sub5_Sub10_Sub3_141;
	public boolean aBoolean142;
	public int anInt143;
	public int[] anIntArray144;
	public int[] anIntArray145;
	public int[][] anIntArrayArray146;
	public int[] anIntArray147;
	public static JString aClass3_148;
	public static int anInt149;
	public int[] anIntArray150;

	public int method143(int i, int i_0_, JString class3) {
		class3 = class3.toLowerCase();
		return aClass11Array136[i_0_].method184(true, class3.getHashCode());
	}

	public void method144(JString class3, byte i) {
		class3 = class3.toLowerCase();
		int i_1_ = aClass11_130.method184(true, class3.getHashCode());
		if (i_1_ >= 0)
			method147(false, i_1_);
	}

	public void method145(int i) {
		for (int i_2_ = i; i_2_ < aByteArrayArrayArray138.length; i_2_++) {
			if (aByteArrayArrayArray138[i_2_] != null) {
				for (int i_3_ = 0; aByteArrayArrayArray138[i_2_].length > i_3_; i_3_++)
					aByteArrayArrayArray138[i_2_][i_3_] = null;
			}
		}
	}

	public int[] method146(int i, int i_4_) {
		return anIntArrayArray139[i_4_];
	}

	public void method147(boolean bool, int i) {
		if (bool)
			method147(false, -63);
	}

	public int method148(boolean bool) {
		return aByteArrayArrayArray138.length;
	}

	public void method149(byte i, int i_5_) {
		if (i != 90)
			anInt143 = -6;
	}

	public static void method150(int i) {
		aClass3_135 = null;
		aClass3_148 = null;
		aClass39_Sub5_Sub10_Sub3_141 = null;
		aClass3_131 = null;
		aClass3_140 = null;
	}

	public byte[] method151(int i, byte i_6_) {
		if (i_6_ != -17)
			return null;
		if (aByteArrayArrayArray138.length == 1)
			return method165(30605, 0, i);
		if (aByteArrayArrayArray138[i].length == 1)
			return method165(i_6_ ^ ~0x779d, i, 0);
		throw new RuntimeException();
	}

	public boolean method152(int i, JString class3, JString class3_7_) {
		class3_7_ = class3_7_.toLowerCase();
		class3 = class3.toLowerCase();
		int i_8_ = aClass11_130.method184(true, class3_7_.getHashCode());
		int i_9_ = aClass11Array136[i_8_].method184(true, class3.getHashCode());
		return method155(i_9_, i_8_, (byte) 76);
	}

	public void method153(int i, int i_10_) {
		for (int i_11_ = 0; i_11_ < aByteArrayArrayArray138[i].length; i_11_++)
			aByteArrayArrayArray138[i][i_11_] = null;
	}

	public byte[] method154(byte i, int i_12_, int i_13_) {
		if (i_12_ < 0 || aByteArrayArrayArray138.length <= i_12_ || aByteArrayArrayArray138[i_12_] == null || i_13_ < 0 || i_13_ >= aByteArrayArrayArray138[i_12_].length)
			return null;
		if (aByteArrayArrayArray138[i_12_][i_13_] == null) {
			boolean bool = method161(i_12_, null, 114);
			if (!bool) {
				method149((byte) 90, i_12_);
				bool = method161(i_12_, null, 124);
				if (!bool)
					return null;
			}
		}
		byte[] is = aByteArrayArrayArray138[i_12_][i_13_];
		return is;
	}

	public boolean method155(int i, int i_14_, byte i_15_) {
		if (i_14_ < 0 || aByteArrayArrayArray138.length <= i_14_ || aByteArrayArrayArray138[i_14_] == null || i < 0 || aByteArrayArrayArray138[i_14_].length <= i)
			return false;
		if (aByteArrayArrayArray138[i_14_][i] != null)
			return true;
		if (aByteArrayArray137[i_14_] != null)
			return true;
		method149((byte) 90, i_14_);
		if (aByteArrayArray137[i_14_] != null)
			return true;
		return false;
	}

	public static void handleStartupInput(byte i) {
		Class1.method50(-120);
		if (Class31.anInt563 == 10) {
			int i_16_ = Class46.mouseButtonType;
			int i_17_ = Class39_Sub4.mouseX - 202;
			int i_18_ = PacketParser.mouseY - 171;
			if (Class10.anInt155 == 0) {
				int i_19_ = 120;
				int i_20_ = 100;
				if (i_16_ == 1 && i_17_ >= i_20_ - 75 && i_17_ <= i_20_ + 75 && i_19_ - 20 <= i_18_ && i_19_ + 20 >= i_18_) {
					Class43.anInt815 = 0;
					Class10.anInt155 = 3;
				}
				i_20_ = 260;
				if (i_16_ == 1 && i_20_ - 75 <= i_17_ && i_20_ + 75 >= i_17_ && i_18_ >= i_19_ - 20 && i_18_ <= i_19_ + 20) {
					Class10.anInt155 = 2;
					Tile.aClass3_1899 = Class14.aClass3_241;
					Tile.aClass3_1916 = Class14.aClass3_235;
					Tile.aClass3_1896 = Login.aClass3_470;
					Class43.anInt815 = 0;
				}
			} else if (Class10.anInt155 != 2) {
				if (Class10.anInt155 == 3) {
					int i_21_ = 180;
					int i_22_ = 150;
					if (i_16_ == 1 && i_17_ >= i_21_ - 75 && i_21_ + 75 >= i_17_ && i_18_ >= i_22_ - 20 && i_22_ + 20 >= i_18_)
						Class10.anInt155 = 0;
				}
			} else {
				int i_23_ = 150;
				int i_24_ = 100;
				int i_25_ = 60;
				i_25_ += 30;
				if (i_16_ == 1 && i_18_ >= i_25_ - 15 && i_18_ < i_25_)
					Class43.anInt815 = 0;
				i_25_ += 15;
				if (i_16_ == 1 && i_18_ >= i_25_ - 15 && i_25_ > i_18_)
					Class43.anInt815 = 1;
				i_25_ += 15;
				if (i_16_ == 1 && i_17_ >= i_24_ - 75 && i_24_ + 75 >= i_17_ && i_23_ - 20 <= i_18_ && i_18_ <= i_23_ + 20) {
					Tile.playerName = Tile.playerName.formatUsername(-32769).capitalizeAfterQuestion((byte) -43);
					Class37.method349(8845, Class39_Sub4.aClass3_1334, Class14.aClass3_267, Class14.aClass3_238);
					Class39_Sub14.method879((byte) 40, 20);
				} else {
					i_24_ = 260;
					if (i_16_ == 1 && i_24_ - 75 <= i_17_ && i_17_ <= i_24_ + 75 && i_23_ - 20 <= i_18_ && i_18_ <= i_23_ + 20) {
						Class10.anInt155 = 0;
						Tile.playerPassword = Tile.aClass3_1906;
						Tile.playerName = Tile.aClass3_1906;
					}
					while (Class39_Sub5_Sub7.method588(-4)) {
						boolean bool = false;
						for (int i_26_ = 0; i_26_ < Class31.aClass3_565.length(); i_26_++) {
							if (Class39_Sub5_Sub4_Sub1.anInt2191 == Class31.aClass3_565.charAt(i_26_)) {
								bool = true;
								break;
							}
						}
						if (Class43.anInt815 != 0) {
							if (Class43.anInt815 == 1) {
								if (Class15.anInt287 == 85 && Tile.playerPassword.length() > 0)
									Tile.playerPassword = (Tile.playerPassword.substring(0, Tile.playerPassword.length() - 1));
								if (Class15.anInt287 == 84 || Class15.anInt287 == 80)
									Class43.anInt815 = 0;
								if (bool && Tile.playerPassword.length() < 20)
									Tile.playerPassword = (Tile.playerPassword.concatChar(Class39_Sub5_Sub4_Sub1.anInt2191));
							}
						} else {
							if (Class15.anInt287 == 85 && Tile.playerName.length() > 0)
								Tile.playerName = (Tile.playerName.substring(0, Tile.playerName.length() - 1));
							if (Class15.anInt287 == 84 || Class15.anInt287 == 80)
								Class43.anInt815 = 1;
							if (bool && Tile.playerName.length() < 20)
								Tile.playerName = (Tile.playerName.concatChar(Class39_Sub5_Sub4_Sub1.anInt2191));
						}
					}
				}
			}
		}
	}

	public byte[] method157(int i, int i_27_, int[] is, byte i_28_) {
		if (i < 0 || aByteArrayArrayArray138.length <= i || aByteArrayArrayArray138[i] == null || i_27_ < 0 || i_27_ >= aByteArrayArrayArray138[i].length)
			return null;
		if (aByteArrayArrayArray138[i][i_27_] == null) {
			boolean bool = method161(i, is, 108);
			if (!bool) {
				method149((byte) 90, i);
				bool = method161(i, is, 116);
				if (!bool)
					return null;
			}
		}
		byte[] is_29_ = aByteArrayArrayArray138[i][i_27_];
		if (aBoolean142)
			aByteArrayArrayArray138[i][i_27_] = null;
		return is_29_;
	}

	public int method158(int i, byte i_30_) {
		return aByteArrayArrayArray138[i].length;
	}

	public boolean method159(int i) {
		boolean bool = true;
		for (int i_31_ = 0; anIntArray147.length > i_31_; i_31_++) {
			int i_32_ = anIntArray147[i_31_];
			if (aByteArrayArray137[i_32_] == null) {
				method149((byte) 90, i_32_);
				if (aByteArrayArray137[i_32_] == null)
					bool = false;
			}
		}
		return bool;
	}

	public static byte[] method160(int i, int i_33_, int i_34_, Class9 class9, int i_35_) {
		long l = ((long) (i + i_34_ * 37 & 0xffff) + (long) (i_34_ << 16) + ((long) i_35_ << 32));
		if (Class39_Sub5_Sub4_Sub4_Sub1.aClass7_2493 != null) {
			Class39_Sub5_Sub7 class39_sub5_sub7 = ((Class39_Sub5_Sub7) Class39_Sub5_Sub4_Sub4_Sub1.aClass7_2493.method133((byte) 0, l));
			if (class39_sub5_sub7 != null)
				return class39_sub5_sub7.aByteArray1785;
		}
		byte[] is = class9.method165(30605, i_34_, i);
		if (is == null)
			return null;
		if (Class39_Sub5_Sub4_Sub4_Sub1.aClass7_2493 != null)
			Class39_Sub5_Sub4_Sub4_Sub1.aClass7_2493.method135(new Class39_Sub5_Sub7(is), l, (byte) -116);
		return is;
	}

	public boolean method161(int i, int[] is, int i_36_) {
		if (aByteArrayArray137[i] == null)
			return false;
		int i_37_ = anIntArray134[i];
		byte[][] is_38_ = aByteArrayArrayArray138[i];
		boolean bool = true;
		int[] is_39_ = anIntArrayArray139[i];
		for (int i_40_ = 0; i_40_ < i_37_; i_40_++) {
			if (is_38_[is_39_[i_40_]] == null) {
				bool = false;
				break;
			}
		}
		if (bool)
			return true;
		byte[] is_41_;
		if (is == null || is[0] == 0 && is[1] == 0 && is[2] == 0 && is[3] == 0)
			is_41_ = aByteArrayArray137[i];
		else {
			is_41_ = new byte[aByteArrayArray137[i].length];
			ArrayOperations.copy(aByteArrayArray137[i], 0, is_41_, 0, is_41_.length);
			Stream class39_sub6 = new Stream(is_41_);
			class39_sub6.decryptXTEA(is, 0, class39_sub6.buffer.length, 5);
		}
		byte[] is_42_ = Class14.method211(-1, is_41_);
		if (i_36_ <= 105)
			anInt129 = 89;
		if (aBoolean132)
			aByteArrayArray137[i] = null;
		if (i_37_ <= 1)
			is_38_[is_39_[0]] = is_42_;
		else {
			int i_43_ = is_42_.length;
			int i_44_ = is_42_[--i_43_] & 0xff;
			int[] is_45_ = new int[i_37_];
			i_43_ -= i_37_ * i_44_ * 4;
			Stream class39_sub6 = new Stream(is_42_);
			class39_sub6.currentOffset = i_43_;
			for (int i_46_ = 0; i_44_ > i_46_; i_46_++) {
				int i_47_ = 0;
				for (int i_48_ = 0; i_37_ > i_48_; i_48_++) {
					i_47_ += class39_sub6.readInt();
					is_45_[i_48_] += i_47_;
				}
			}
			for (int i_49_ = 0; i_37_ > i_49_; i_49_++) {
				if (is_38_[is_39_[i_49_]] == null)
					is_38_[is_39_[i_49_]] = new byte[is_45_[i_49_]];
				is_45_[i_49_] = 0;
			}
			int i_50_ = 0;
			class39_sub6.currentOffset = i_43_;
			for (int i_51_ = 0; i_44_ > i_51_; i_51_++) {
				int i_52_ = 0;
				for (int i_53_ = 0; i_37_ > i_53_; i_53_++) {
					i_52_ += class39_sub6.readInt();
					ArrayOperations.copy(is_42_, i_50_, is_38_[is_39_[i_53_]], is_45_[i_53_], i_52_);
					is_45_[i_53_] += i_52_;
					i_50_ += i_52_;
				}
			}
		}
		return true;
	}

	public static void updateOtherPlayers(byte i) {
		int i_54_ = Class39_Sub5_Sub11.inputStream.readBits(8);
		if (i_54_ < CollisionMap.anInt515) {
			for (int i_55_ = i_54_; i_55_ < CollisionMap.anInt515; i_55_++)
				Class26.anIntArray496[Class40.anInt749++] = Class1.anIntArray40[i_55_];
		}
		if (CollisionMap.anInt515 < i_54_)
			throw new RuntimeException("gppov1 " + CollisionMap.anInt515 + " - " + i_54_);
		CollisionMap.anInt515 = 0;
		for (int i_56_ = 0; i_56_ < i_54_; i_56_++) {
			int i_57_ = Class1.anIntArray40[i_56_];
			Player class39_sub5_sub4_sub4_sub2 = Class14.aClass39_Sub5_Sub4_Sub4_Sub2Array211[i_57_];
			int i_58_ = Class39_Sub5_Sub11.inputStream.readBits(1);
			if (i_58_ == 0) {
				Class1.anIntArray40[CollisionMap.anInt515++] = i_57_;
				class39_sub5_sub4_sub4_sub2.anInt2290 = Class2.anInt48;
			} else {
				int i_59_ = Class39_Sub5_Sub11.inputStream.readBits(2);
				if (i_59_ == 0) {
					Class1.anIntArray40[CollisionMap.anInt515++] = i_57_;
					class39_sub5_sub4_sub4_sub2.anInt2290 = Class2.anInt48;
					Class39_Sub9.anIntArray1400[Class57_Sub2.anInt1586++] = i_57_;
				} else if (i_59_ == 1) {
					Class1.anIntArray40[CollisionMap.anInt515++] = i_57_;
					class39_sub5_sub4_sub4_sub2.anInt2290 = Class2.anInt48;
					int i_60_ = Class39_Sub5_Sub11.inputStream.readBits(3);
					class39_sub5_sub4_sub4_sub2.method518(-1, i_60_, false);
					int i_61_ = Class39_Sub5_Sub11.inputStream.readBits(1);
					if (i_61_ == 1)
						Class39_Sub9.anIntArray1400[Class57_Sub2.anInt1586++] = i_57_;
				} else if (i_59_ == 2) {
					Class1.anIntArray40[CollisionMap.anInt515++] = i_57_;
					class39_sub5_sub4_sub4_sub2.anInt2290 = Class2.anInt48;
					int i_62_ = Class39_Sub5_Sub11.inputStream.readBits(3);
					class39_sub5_sub4_sub4_sub2.method518(-1, i_62_, true);
					int i_63_ = Class39_Sub5_Sub11.inputStream.readBits(3);
					class39_sub5_sub4_sub4_sub2.method518(-1, i_63_, true);
					int i_64_ = Class39_Sub5_Sub11.inputStream.readBits(1);
					if (i_64_ == 1)
						Class39_Sub9.anIntArray1400[Class57_Sub2.anInt1586++] = i_57_;
				} else if (i_59_ == 3)
					Class26.anIntArray496[Class40.anInt749++] = i_57_;
			}
		}
	}

	public int method163(JString class3, byte i) {
		if (i != 30)
			aByteArrayArrayArray138 = null;
		class3 = class3.toLowerCase();
		return aClass11_130.method184(true, class3.getHashCode());
	}

	public boolean method164(boolean bool, int i) {
		if (aByteArrayArray137[i] != null)
			return true;
		method149((byte) 90, i);
		if (aByteArrayArray137[i] != null)
			return true;
		return false;
	}

	public byte[] method165(int i, int i_65_, int i_66_) {
		return method157(i_65_, i_66_, null, (byte) 73);
	}

	public byte[] method166(int i, boolean bool) {
		if (aByteArrayArrayArray138.length == 1)
			return method154((byte) -115, 0, i);
		if (aByteArrayArrayArray138[i].length == 1)
			return method154((byte) -116, i, 0);
		throw new RuntimeException();
	}

	public byte[] method167(JString class3, JString class3_67_, int i) {
		class3 = class3.toLowerCase();
		class3_67_ = class3_67_.toLowerCase();
		int i_68_ = aClass11_130.method184(true, class3.getHashCode());
		int i_69_ = aClass11Array136[i_68_].method184(true, class3_67_.getHashCode());
		return method165(30605, i_68_, i_69_);
	}

	public void method168(byte[] is, byte i) {
		anInt143 = Class13.method189(7, is.length, is);
		Stream class39_sub6 = new Stream(Class14.method211(-1, is));
		int i_70_ = class39_sub6.readByte((byte) -8);
		if (i_70_ == 5) {
			int i_71_ = class39_sub6.readByte((byte) -8);
			int i_72_ = 0;
			int i_73_ = -1;
			anInt129 = class39_sub6.readShort(-62);
			anIntArray147 = new int[anInt129];
			for (int i_74_ = 0; anInt129 > i_74_; i_74_++) {
				anIntArray147[i_74_] = i_72_ += class39_sub6.readShort(-117);
				if (anIntArray147[i_74_] > i_73_)
					i_73_ = anIntArray147[i_74_];
			}
			anIntArray134 = new int[i_73_ + 1];
			anIntArrayArray139 = new int[i_73_ + 1][];
			anIntArray144 = new int[i_73_ + 1];
			anIntArray145 = new int[i_73_ + 1];
			aByteArrayArrayArray138 = new byte[i_73_ + 1][][];
			aByteArrayArray137 = new byte[i_73_ + 1][];
			if (i_71_ != 0) {
				anIntArray150 = new int[i_73_ + 1];
				for (int i_75_ = 0; anInt129 > i_75_; i_75_++)
					anIntArray150[anIntArray147[i_75_]] = class39_sub6.readInt();
				aClass11_130 = new Class11(anIntArray150);
			}
			for (int i_76_ = 0; i_76_ < anInt129; i_76_++)
				anIntArray145[anIntArray147[i_76_]] = class39_sub6.readInt();
			for (int i_77_ = 0; anInt129 > i_77_; i_77_++)
				anIntArray144[anIntArray147[i_77_]] = class39_sub6.readInt();
			for (int i_78_ = 0; i_78_ < anInt129; i_78_++)
				anIntArray134[anIntArray147[i_78_]] = class39_sub6.readShort(-38);
			for (int i_79_ = 0; anInt129 > i_79_; i_79_++) {
				i_72_ = 0;
				int i_80_ = anIntArray147[i_79_];
				int i_81_ = anIntArray134[i_80_];
				int i_82_ = -1;
				anIntArrayArray139[i_80_] = new int[i_81_];
				for (int i_83_ = 0; i_81_ > i_83_; i_83_++) {
					int i_84_ = (anIntArrayArray139[i_80_][i_83_] = i_72_ += class39_sub6.readShort(104));
					if (i_82_ < i_84_)
						i_82_ = i_84_;
				}
				aByteArrayArrayArray138[i_80_] = new byte[i_82_ + 1][];
			}
			if (i_71_ != 0) {
				anIntArrayArray146 = new int[i_73_ + 1][];
				aClass11Array136 = new Class11[i_73_ + 1];
				for (int i_85_ = 0; anInt129 > i_85_; i_85_++) {
					int i_86_ = anIntArray147[i_85_];
					int i_87_ = anIntArray134[i_86_];
					anIntArrayArray146[i_86_] = new int[aByteArrayArrayArray138[i_86_].length];
					for (int i_88_ = 0; i_88_ < i_87_; i_88_++)
						anIntArrayArray146[i_86_][(anIntArrayArray139[i_86_][i_88_])] = class39_sub6.readInt();
					aClass11Array136[i_86_] = new Class11(anIntArrayArray146[i_86_]);
				}
			}
			int i_89_ = 49 / ((i + 37) / 59);
		}
	}

	public Class9(boolean bool, boolean bool_90_) {
		aBoolean132 = bool;
		aBoolean142 = bool_90_;
	}

	static {
		aClass3_131 = Class39_Sub5_Sub9.createJString(124, "auf der Hautpseite)3");
		aClass3_140 = Class39_Sub5_Sub9.createJString(105, "Nehmen");
		aClass3_148 = aClass3_135;
		anInt133 = 0;
		anInt149 = 127;
	}
}
